<html>
<head><meta charset="utf-8"><title>building just the std for the target? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/building.20just.20the.20std.20for.20the.20target.3F.html">building just the std for the target?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231435365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/building%20just%20the%20std%20for%20the%20target%3F/near/231435365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/building.20just.20the.20std.20for.20the.20target.3F.html#231435365">(Mar 23 2021 at 08:21)</a>:</h4>
<p>I am building for OpenWrt, I currently build out the toolchain dist and generate the following files:</p>
<div class="codehilite"><pre><span></span><code>cargo-nightly-x86_64-unknown-linux-gnu.tar.xz          rust-analyzer-nightly-x86_64-unknown-linux-gnu.tar.xz
clippy-nightly-x86_64-unknown-linux-gnu.tar.xz         rust-nightly-x86_64-unknown-linux-gnu.tar.xz
llvm-tools-nightly-x86_64-unknown-linux-gnu.tar.xz     rust-std-nightly-aarch64-openwrt-linux-musl.tar.xz
miri-nightly-x86_64-unknown-linux-gnu.tar.xz           rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
rls-nightly-x86_64-unknown-linux-gnu.tar.xz            rustc-nightly-x86_64-unknown-linux-gnu.tar.xz
rust-analysis-nightly-x86_64-unknown-linux-gnu.tar.xz  rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
</code></pre></div>
<p>I am building for multiple targets from the same host.  So, in reality, changing the target and rebuilding the toolchain really only generates a single file (<code>rust-std-nightly-aarch64-openwrt-linux-musl.tar.xz</code> in the list above).</p>
<p>Right now I'm building everything out, and dividing the host dist tarballs from the target ones.  The goal is to re-use the host binary tarballs and generate new std for the targets if needed.  I can generate the entire thing again if necessary and process out the std for the target.</p>
<p>Is there a way to generate (from source) just the stage 0/1/2 that are needed to create just the target std, or using the installed host installed rustc/cargo?</p>



<a name="231467391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/building%20just%20the%20std%20for%20the%20target%3F/near/231467391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/building.20just.20the.20std.20for.20the.20target.3F.html#231467391">(Mar 23 2021 at 13:13)</a>:</h4>
<p>There's potentially hacks you could use, but I don't think there's an easy way to do it today. It should be possible to build for any number of hosts and targets at the same time, though.</p>



<a name="231544061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/building%20just%20the%20std%20for%20the%20target%3F/near/231544061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/building.20just.20the.20std.20for.20the.20target.3F.html#231544061">(Mar 23 2021 at 21:08)</a>:</h4>
<p>The issue is that there is no way to tell before hand what triples is going to be called.  But, I found that if I <code>x.py dist std</code> it is significantly shorter and seems to have the std lib for the target triple, so that worked out :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>